<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        ul {
            padding: 100px 0 0;
            margin: 0 auto;
            width: 500px;
            height: 300px;
        }

        ul li {
            text-align: center;
            list-style: none;
            height: 300px;
            width: 300px;
            border: 1px solid red;
        }
    </style>
</head>

<body>

    <ul id="ul">

    </ul>



    <script>
        let shu = [
            { id: 1, img: "../images/0.png", name: "高级技师1", price: "￥30", age: "18" },
            { id: 2, img: "../images/1.png", name: "高级技师1", price: "￥33", age: "17" },
            { id: 3, img: "../images/2.png", name: "高级技师1", price: "￥53", age: "22" },
            { id: 4, img: "../images/3.png", name: "高级技师1", price: "￥93", age: "14" }
        ]

        let a = location.search;
        // console.log(a)
        a = a.substring(1);
        a = a.split("=");
        let obj1 = {};
        obj1[a[0]] = a[1];
        let idx1 = shu.filter((items, index) => {
            return items.id == obj1.id
        })
        shu.forEach((item, index) => {
            if (item.id == obj1.id) {
                ul.innerHTML = `  <li  idx="` + item.id + `">
            <img src="`+ item.img + `" alt="">
            <p>名字：`+ item.name + `</p>
            <p>价格：`+ item.price + `</p>
            <p>年龄：`+ item.age + `</p>
        </li>`
            }
        })

        // console.log(idx1)
    </script>

</body>

</html>